﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using TestXNA3.Resources.Meshes;
using TestXNA3.Resources;
using System.Runtime.Serialization;

namespace TestXNA3.Components
{
    [Serializable]
    public class SpriteComponent : Component
    {
        private Sprite _sprite;
        public TextureResource Texture
        {
            get { return _sprite.Texture; }
            set { _sprite.Texture = value; }
        }

        public SpriteComponent()
        {
            Saveable = false;
            _sprite = new Sprite("");
        }

        public override void AddToRenderQueue(TestXNA3.Render.SceneRenderer sceneRenderer, ref List<TestXNA3.Resources.MeshResource> meshes)
        {
            _sprite.World = Parent.Axis;
            _sprite.Size = Parent.BoundingBoxSize;
            meshes.Add(_sprite);
        }

        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);
        }
    }
}
